package com.zjht.gmcc.bean.action;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.zjht.gmcc.bean.util.MyJDBC;
public class ProductUtil implements java.io.Serializable {
	private static final long serialVersionUID = 2923159838657051800L;
	public static String getTypeName(String typeid){
		String typename="";
		MyJDBC myJDBC = null;
		try {
			myJDBC = new MyJDBC();
			String strSQL = "SELECT typename FROM producttype WHERE typeid=?";
			PreparedStatement ps = myJDBC.prepareStatement(strSQL);
			ps.setString(1, typeid);
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				typename = rs.getString(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			MyJDBC.close(myJDBC);
		}
		return typename;
	}
	
	public static String getProviderTypeName(String providertypeid){
		String providertypename="";
		MyJDBC myJDBC = null;
		try {
			myJDBC = new MyJDBC();
			String strSQL = "SELECT providertypename FROM providertype WHERE providertypeid=?";
			PreparedStatement ps = myJDBC.prepareStatement(strSQL);
			ps.setString(1, providertypeid);
			ResultSet rs = ps.executeQuery();
			if (rs.next()) {
				providertypename = rs.getString(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			MyJDBC.close(myJDBC);
		}
		return providertypename;
	}
}
